package com.yuan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuan.黄鹏.Zhcxmx;
import com.yuan.黄鹏.ZuiZhongBjmx;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
 *  @author 雨安
 *  类名： ZhcxmxMapper
 *  创建时间：2024/4/18
 */
@Repository
public interface ZhcxmxMapper extends BaseMapper<Zhcxmx> {
    //查询所有公司名
    @Select("select bj.house_name from bjmx bj\n" +
            "   left join hbcarmx hb on bj.car_no = hb.car_no\n" +
            "   left join zhcxmx zh on zh.car_no = bj.car_no\n" +
            "group by bj.house_name")
    List<String> selectAllFirmName();

    //查询最终数据的集合
    @Select("select bj.*,hb.driveremp\n" +
            "from bjmx bj\n" +
            "left join hbcarmx hb on bj.car_no = hb.car_no\n" +
            "left join zhcxmx zh on zh.car_no = bj.car_no where 1=1  ${condition }")
    List<ZuiZhongBjmx> selectAllOfFirm(@Param("condition")String condition);

    //匹配每辆车最终的数量
    @Select("select count(*)\n" +
            "from bjmx bj\n" +
            "left join hbcarmx hb on bj.car_no = hb.car_no\n" +
            "left join zhcxmx zh on zh.car_no = bj.car_no where 1=1  ${condition}")
    Integer selectCarCount(@Param("condition")String condition);


}
